<?php
error_reporting(0);
define('IN_QY',true);
session_start();
require("include/common.inc.php");
define('SCRIPT','ad_list');
//
if(!$_COOKIE['userid']){
      echo "<script type='text/javascript'>location.href='/wap/mlogin.php';</script>";
      exit;
}

if($_GET['scc']==3){
$sql = "update tbl_taorder set is_pay=2  where addtime='".$_GET['sc']."'";
mysql_query($sql);
  echo "<script type='text/javascript'>alert('删除成功');history.go(-1);</script>";
  exit;
}

?>



<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title><?=$_COOKIE['shuyu']?>海淘-待支付-众晒网</title>
    <link rel="stylesheet" type="text/css" href="/ui/css/Hui.css" />
    <style type="text/css">
    <style type="text/css">
            #header{width:100%; position:absolute; top:0;}
             #footer{width:100%; position:absolute; bottom:0;}
        #main{width:100%; overflow: auto; position:absolute; top:45px;bottom:55px;}

    </style> 	
    </style>
</head>
<body class="H-flexbox-vertical">
    <header class="H-header H-theme-background-color-white" id="header">
        <span tapmode="" onclick="H.closeWin();" class="H-icon H-position-relative H-display-inline-block H-float-left H-vertical-middle H-theme-font-color-white H-padding-horizontal-left-5 H-z-index-100"><i class="H-iconfont H-theme-font-color-black H-icon-arrow-left H-font-size-18 H-vertical-middle"></i></span>
        <div class="H-header-title H-center-all H-font-size-18 H-text-show-row-1 H-theme-font-color-black H-position-absolute H-width-100-percent H-theme-background-white">
            待支付
        </div>
    </header>
    <div id="main">

  <?php

           $sql1 = "select * from tbl_taorder where id in (select min(id) from tbl_taorder group by orderid ) and is_pay=3 and uid='".$_COOKIE['userid']."' order by id desc";
           $query1 = mysql_query($sql1);
		
        if(!mysql_affected_rows()){
            echo '
                <div class="H-padding-vertical-bottom-10"></div>
                </br>
    <div class="H-channel-title H-flexbox-horizontal H-theme-background-color-white H-vertical-middle H-border-vertical-bottom-after">
        <div class="H-channel-line H-theme-background-color8 H-padding-vertical-top-15 H-padding-horizontal-left-3  H-margin-horizontal-left-10"></div>
        <div class="H-channel-text H-theme-font-color8 H-flex-item H-font-size-18 H-theme-font-color-black H-padding-10 H-margin-horizontal-right-10 H-text-show-row-1">暂无待支付商品</div>
    </div>
    </br></br>
            ';
}        
        while ($row=mysql_fetch_array($query1)) {
            
    ?>  
    <div id="lis" class="H-padding-8" style="width:96%;" >
        <div id="list1" class="H-border-radius3-px H-theme-background-color-white H-margin-vertical-bottom-5 H-border-vertical-both-after H-border-horizontal-both-after" >

            <div class="H-padding-10 H-border-vertical-bottom-after H-flexbox-horizontal H-theme-font-color-999 H-font-size-14 H-flexbox-horizontal H-text-horizontal-left H-box-sizing-border-box">
            	<span class="H-font-size-10">订单号：<?=$row['orderid']?></span><span class="H-font-size-10 H-display-block H-flex-item H-text-align-right"><?php echo date("Y-m-d",$row['addtime'])  ?></span>
            </div>
			
			  <?php
        $sql2 = "select * from tbl_taorder  where uid='".$_COOKIE['userid']."'  AND orderid='".$row['orderid']."'";
        $query2=mysql_query($sql2);

		while ($row2=mysql_fetch_array($query2)) {    
      
    ?> 
	
	     <?php
       $sql3 = "select * from tbl_taospp  where id='".$row2['goodid']."'";
        $query3=mysql_query($sql3);
		$row3=mysql_fetch_array($query3);
		 $a=explode(',', $row3['img']);
		 ?>
		 
            <div class="H-flexbox-horizontal H-theme-background-color-white H-border-vertical-bottom-after" onclick="H.openWin('#', '#');">
                <div class="H-padding-vertical-both-10">
                    <img src="<?php echo $a[0] ?>" srcs="" alt="" title="" class="imgCache H-display-block H-margin-horizontal-left-10" style="width: 70px; height:70px;" />
                </div>
                <div class="H-flex-item H-padding-10 ">
                	<span class="H-font-size-10 H-display-block H-flex-item H-text-align-right H-border-radius-3 H-theme-font-color-white" style="float:right;background-color:#EE7942;width:37px">待支付</span>
                    <strong class="H-font-weight-normal font-weight-500 H-font-size-12 H-theme-font-color-black H-display-block H-text-show-row-1"><?php echo $row3['chtitle'] ?></strong>
					  
                    <div class="H-font-size-10 H-theme-font-color-999 H-text-show-row-2">
                       <?php echo $row3['origin'] ?>,<?php echo $row3['brand'] ?>
                    </div>                     
                    <div class="H-font-size-10 H-theme-font-color-999 H-text-show-row-2">                 
                        购买数量<strong><span class="H-font-size-14" style="color:#EE7942"><?php echo $row['gnum'] ?></span></strong> 
                    </div> 
                    <div class="H-font-size-10 H-theme-font-color-999 H-text-show-row-2">                 
                        规格<strong><span class="H-font-size-14" style="color:#EE7942">
						<?php if($row['bunit']==1){ ?>
					    单件
						<?php } ?>
						<?php if($row['bunit']==2){ ?>
					  整箱
						<?php } ?>
						
						</span></strong> 
                    </div> 					
					
                </div>
            </div>
			
			  <?php } ?>
			
			
			
            
            <div class="H-padding-10 H-border-vertical-bottom-after H-flexbox-horizontal H-theme-font-color-999 H-font-size-14 H-flexbox-horizontal H-text-horizontal-left H-box-sizing-border-box">

                <span class="H-display-block H-flex-item H-text-align-right H-theme-font-color7-active">
				 <!--################### 华丽的分割线 #######
				<span class="H-font-size-10 H-display-block H-flex-item H-text-align-center H-border-radius-5 H-theme-font-color-white" style="float:left;background-color:#EE7942;width:55px">合计:</span>
				############-->
				
                <span class="H-badge H-display-inline-block">

              <a href="?scc=3&sc=<?php echo $row['addtime']; ?>" onClick="if (confirm('确定要取消吗？')) return true; else return false;" ><button class="H-outline-none H-theme-background-color-transparent H-theme-border-color-black H-font-size-13 H-padding-horizontal-both-15 H-theme-font-color-black H-theme-background-color1-click H-theme-font-color1-click H-theme-border-color1-click H-border-radius-3 H-white-space-nowrap rollIn text-decoration:none">取消订单</button></a>

                <?
                    // 是否需要清关 商品分类是22，23 要清关
                    $orderid = $row['orderid'];
                    $sql_p = "select tb.typeid from tbl_taospp AS tb WHERE tb.id in (select goodid from tbl_taorder where orderid = '$orderid') ";
                    $re_p = c_getRows($sql_p);
                    $re_p = array_column($re_p,'typeid');
                    if(in_array('22',$re_p)  || in_array('23',$re_p)){
                         // 是否有清关的身份证
                        $sql_qin = "select identify_pic from tpl_qinguan WHERE user_id = ".$_COOKIE['userid']." limit 1";
                        $res_qin=mysql_query($sql_qin);
                        if($res_qin){
                        }else{
                              $userid = $_COOKIE['userid'];
                              echo " <button onclick=\"H.openWin('djfuqian', 'qinguan.php?fid=$userid');\" class=\"H-outline-none H-theme-background-color-transparent H-theme-border-color8 H-font-size-13 H-padding-horizontal-both-15 H-theme-font-color8 H-theme-background-color1-click H-theme-font-color1-click H-theme-border-color1-click H-border-radius-3 H-white-space-nowrap\">上传身份证</button>";

                        }
                    }


                ?>

                <button onclick="H.openWin('djfuqian', '/haigou/djfuqian.php?fid=<?=$orderid?>');" class="H-outline-none H-theme-background-color-transparent H-theme-border-color8 H-font-size-13 H-padding-horizontal-both-15 H-theme-font-color8 H-theme-background-color1-click H-theme-font-color1-click H-theme-border-color1-click H-border-radius-3 H-white-space-nowrap">去支付</button>
                 </span>
				 </span>

            </div> 

       <!--################### 华丽的分割线 ###################-->
 
	  <!--################### 底部开始线 ###################-->
            
        </div>
        </div>
        <?php } ?>
    </div>
  <footer id="foots">
  <?include('footer.php');?> 
  </footer>  
  
    <script type="text/javascript" src="/ui/script/H.js"></script>
	<script type="text/javascript" src="/ui/js/jquery-1.9.1.min.js"></script>
</body>
</html>